<template>
  <a-drawer
    :title="formInfo.id == undefined ? '新增筛选组' : '修改筛选组'"
    :maskClosable="true"
    width="800"
    placement="right"
    :closable="true"
    @close="handleCancel"
    :destroyOnClose="true"
    :visible="visible"
  >
    <a-spin :spinning="confirmLoading">
      <a-form-model
        ref="ruleForm"
        :model="formInfo"
        :label-col="$global.labelCol"
        :wrapper-col="$global.wrapperCol"
      >
        <a-row>
          <a-col>
            <a-form-model-item
              label="筛选组名称"
              prop="name"
              :rules="$valid.required"
              :maxLength="50"
            >
              <a-input
                v-model="formInfo.name"
                placeholder="请输入名称筛选组名称"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col>
            <a-form-model-item
              label="状态"
              prop="status"
              :rules="$valid.required"
              :maxLength="50"
            >
              <a-radio-group
                v-model="formInfo.status"
                style="line-height: 35px"
              >
                <a-radio key="0" value="0" class="radio-item">禁用</a-radio>
                <a-radio key="1" value="1" class="radio-item">启用</a-radio>
              </a-radio-group>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col>
            <a-form-model-item
              label="排序"
              prop="sortOrder"
              :rules="$valid.required"
              :maxLength="50"
            >
              <a-input
                type="number"
                :min="0"
                v-model="formInfo.sortOrder"
                placeholder="请输入排序"
              />
            </a-form-model-item>
          </a-col>
        </a-row>

        <a-divider orientation="left"
          ><span style="text-align: center; color: red; margin-right: 3px"
            >*</span
          >筛选条件(不能为空)</a-divider
        >
        <a-row>
          <a-col :span="12">
            <a-form-model-item label="通用名:" prop="status" :maxLength="50">
              <a-select
                :size="'default'"
                style="min-width: 100px"
                :showArrow="true"
                :allowClear="true"
                v-model="selectFormInfo.commonName"
                placeholder="请选择"
                show-search
              >
                <a-select-option
                  v-for="item in commonNameList"
                  :key="item.id"
                  :value="item.id"
                >
                  {{ item.commonName }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="CFDA:" prop="cfda" :maxLength="50">
              <a-select
                :size="'default'"
                style="min-width: 100px"
                :showArrow="true"
                :allowClear="true"
                v-model="selectFormInfo.cfda"
                placeholder="请选择"
              >
                <a-select-option
                  v-for="item in this.$sysDictOptions('CFDA')"
                  :key="item.k"
                  :value="item.k"
                >
                  {{ item.v }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="使用状态:"
              prop="activeState"
              :maxLength="50"
            >
              <a-select
                :size="'default'"
                style="min-width: 100px"
                :showArrow="true"
                :allowClear="true"
                v-model="selectFormInfo.activeState"
                placeholder="请选择"
              >
                <a-select-option
                  v-for="item in this.$sysDictOptions('activeState')"
                  :key="item.k"
                  :value="item.k"
                >
                  {{ item.v }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="资产状态:"
              prop="assetStatus"
              :maxLength="50"
            >
              <a-select
                :size="'default'"
                style="min-width: 100px"
                :showArrow="true"
                :allowClear="true"
                v-model="selectFormInfo.assetStatus"
                placeholder="请选择"
              >
                <a-select-option
                  v-for="item in this.$sysDictOptions('assetStatus')"
                  :key="item.k"
                  :value="item.k"
                >
                  {{ item.v }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="保修状态:"
              prop="repairState"
              :maxLength="50"
            >
              <a-select
                :size="'default'"
                style="min-width: 100px"
                :showArrow="true"
                :allowClear="true"
                v-model="selectFormInfo.repairState"
                placeholder="请选择"
              >
                <a-select-option
                  v-for="item in this.$sysDictOptions('repair_state')"
                  :key="item.k"
                  :value="item.k"
                >
                  {{ item.v }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="资产编码:"
              prop="assetCode"
              :maxLength="50"
            >
              <a-select
                :size="'default'"
                style="min-width: 100px"
                :showArrow="true"
                :allowClear="true"
                v-model="selectFormInfo.assetCode"
                placeholder="请选择"
              >
                <a-select-option
                  v-for="item in this.$sysDictOptions('assetCode')"
                  :key="item.k"
                  :value="item.k"
                >
                  {{ item.v }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="固定资产:"
              prop="fixedAssets"
              :maxLength="50"
            >
              <a-select
                :size="'default'"
                style="min-width: 100px"
                :showArrow="true"
                :allowClear="true"
                v-model="selectFormInfo.fixedAssets"
                placeholder="请选择"
              >
                <a-select-option
                  v-for="item in this.$sysDictOptions('fixedAssets')"
                  :key="item.k"
                  :value="item.k"
                >
                  {{ item.v }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="有效期:" prop="assetCode" :maxLength="50">
              <a-select
                :size="'default'"
                style="min-width: 100px"
                :showArrow="true"
                :allowClear="true"
                v-model="selectFormInfo.period"
                placeholder="请选择"
              >
                <a-select-option
                  v-for="item in this.$sysDictOptions('period')"
                  :key="item.k"
                  :value="item.k"
                >
                  {{ item.v }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item label="类型:" prop="deviceType" :maxLength="50">
              <a-tree-select
                v-model:value="selectFormInfo.deviceType"
                style="width: 100%"
                :tree-data="deviceTypeTree"
                tree-checkable
                :treeCheckStrictly="true"
                allow-clear
                placeholder="请选择类型"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="专业分类:"
              prop="professionalClassificationId"
              :maxLength="50"
            >
              <a-tree-select
                v-model:value="selectFormInfo.professionalClassificationId"
                style="width: 100%"
                :tree-data="professionalClassificationIdTree"
                tree-checkable
                :treeCheckStrictly="true"
                allow-clear
                placeholder="请选择专业分类"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="当前位置:"
              prop="currentLocation"
              :maxLength="50"
            >
              <a-cascader
                v-model="selectFormInfo.currentLocation"
                :options="campusBuildingFloorRoomTree"
                :change-on-select="false"
                expand-trigger="click"
                style="width: 100%"
                placeholder="请选择"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="所属科室:"
              prop="assetCode"
              :maxLength="50"
            >
              <a-tree-select
                v-model="selectFormInfo.departmentId"
                style="width: 100%"
                tree-checkable
                :treeCheckStrictly="true"
                allow-clear
                :tree-data="departmentTree"
                placeholder="请选择所属科室"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="使用科室:"
              prop="assetCode"
              :maxLength="50"
            >
              <a-tree-select
                v-model="selectFormInfo.usingDepartmentId"
                style="width: 100%"
                tree-checkable
                :treeCheckStrictly="true"
                allow-clear
                :tree-data="departmentTree"
                placeholder="请选择使用科室"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="供应商:"
              prop="supplierName"
              :maxLength="50"
            >
              <a-input
                v-model="selectFormInfo.supplierName"
                placeholder="请输入供应商"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="进口/国产:"
              prop="importedDomestic"
              :maxLength="50"
            >
              <a-select
                :size="'default'"
                style="min-width: 100px"
                :showArrow="true"
                :allowClear="true"
                v-model="selectFormInfo.importedDomestic"
                placeholder="请选择"
              >
                <a-select-option
                  v-for="item in this.$sysDictOptions('importedDomestic')"
                  :key="item.k"
                  :value="item.k"
                >
                  {{ item.v }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="国别:"
              prop="differentCountrie"
              :maxLength="50"
            >
              <a-select
                :size="'default'"
                style="min-width: 100px"
                :showArrow="true"
                :allowClear="true"
                v-model="selectFormInfo.differentCountrie"
                placeholder="请选择"
              >
                <a-select-option
                  v-for="item in this.$sysDictOptions('differentCountrie')"
                  :key="item.k"
                  :value="item.k"
                >
                  {{ item.v }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="生产厂商:"
              prop="manufacturerName"
              :maxLength="50"
            >
              <a-input
                v-model="selectFormInfo.manufacturerName"
                placeholder="请输入生产厂商"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="资产价值:"
              prop="assetValue"
              :maxLength="50"
            >
              <a-input
                type="number"
                v-model="selectFormInfo.assetValueMin"
                placeholder="最小值"
                style="width: 114px"
              />
              ~
              <a-input
                type="number"
                v-model="selectFormInfo.assetValueMax"
                placeholder="最大值"
                style="width: 115px"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="采购日期:"
              prop="purchaseDate"
              :maxLength="50"
            >
              <a-date-picker
                v-model="selectFormInfo.purchaseDate"
                inputReadOnly
                type="date"
                format="YYYY-MM-DD"
                valueFormat="YYYY-MM-DD"
                placeholder="请选择采购日期"
                style="width: 100%"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="失效日期:"
              prop="expiringDate"
              :maxLength="50"
            >
              <a-date-picker
                v-model="selectFormInfo.expiringDate"
                inputReadOnly
                type="date"
                format="YYYY-MM-DD"
                valueFormat="YYYY-MM-DD"
                placeholder="请选择失效日期"
                style="width: 100%"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="验收日期:"
              prop="acceptanceDate"
              :maxLength="50"
            >
              <a-date-picker
                v-model="selectFormInfo.acceptanceDate"
                inputReadOnly
                type="date"
                format="YYYY-MM-DD"
                valueFormat="YYYY-MM-DD"
                placeholder="请选择验收日期"
                style="width: 100%"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="录入日期:"
              prop="entryDate"
              :maxLength="50"
            >
              <a-date-picker
                v-model="selectFormInfo.entryDate"
                inputReadOnly
                type="date"
                format="YYYY-MM-DD"
                valueFormat="YYYY-MM-DD"
                placeholder="请选择录入日期"
                style="width: 100%"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="录入方式:"
              prop="inputMethod"
              :maxLength="50"
            >
              <a-select
                :size="'default'"
                style="min-width: 100px"
                :showArrow="true"
                :allowClear="true"
                v-model="selectFormInfo.inputMethod"
                placeholder="请选择"
              >
                <a-select-option
                  v-for="item in this.$sysDictOptions('inputMethod')"
                  :key="item.k"
                  :value="item.k"
                >
                  {{ item.v }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="录入来源:"
              prop="enterSource"
              :maxLength="50"
            >
              <a-select
                :size="'default'"
                style="min-width: 100px"
                :showArrow="true"
                :allowClear="true"
                v-model="selectFormInfo.enterSource"
                placeholder="请选择"
              >
                <a-select-option
                  v-for="item in this.$sysDictOptions('enterSource')"
                  :key="item.k"
                  :value="item.k"
                >
                  {{ item.v }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="管理部门:"
              prop="administrativeDept"
              :maxLength="50"
            >
              <a-select
                :size="'default'"
                style="min-width: 100px"
                :showArrow="true"
                :allowClear="true"
                v-model="selectFormInfo.administrativeDept"
                placeholder="请选择"
              >
                <a-select-option
                  v-for="item in this.$sysDictOptions('administrativeDept')"
                  :key="item.k"
                  :value="item.k"
                >
                  {{ item.v }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="器械分类:"
              prop="deviceClassificationId"
              :maxLength="50"
            >
              <a-tree-select
                v-model:value="selectFormInfo.deviceClassificationId"
                style="width: 100%"
                :tree-data="deviceClassificationTree"
                tree-checkable
                :treeCheckStrictly="true"
                allow-clear
                placeholder="请选择器械分类"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="强检目录:"
              prop="mandatoryInspectionCatalogId"
              :maxLength="50"
            >
              <a-tree-select
                v-model:value="selectFormInfo.mandatoryInspectionCatalogId"
                style="width: 100%"
                :tree-data="mandatoryInspectionCatalogTree"
                tree-checkable
                :treeCheckStrictly="true"
                allow-clear
                placeholder="请选择强检目录"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="政采目录:"
              prop="politicalProcurementCatalogueId"
              :maxLength="50"
            >
              <a-tree-select
                v-model:value="selectFormInfo.politicalProcurementCatalogueId"
                style="width: 100%"
                :tree-data="politicalProcurementCatalogueTree"
                tree-checkable
                :treeCheckStrictly="true"
                allow-clear
                placeholder="请选择政采目录"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="部队通用名:"
              prop="commonMilitaryNameId"
              :maxLength="50"
            >
              <a-tree-select
                v-model:value="selectFormInfo.commonMilitaryNameId"
                style="width: 100%"
                :tree-data="commonMilitaryNameTree"
                tree-checkable
                :treeCheckStrictly="true"
                allow-clear
                placeholder="请选择部队通用名"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="固资分类:"
              prop="fixedClassificationId"
              :maxLength="50"
            >
              <a-tree-select
                v-model:value="selectFormInfo.fixedClassificationId"
                style="width: 100%"
                :tree-data="fixedClassificationTree"
                tree-checkable
                :treeCheckStrictly="true"
                allow-clear
                placeholder="请选择固资分类"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="12">
            <a-form-model-item
              label="高等学校固定资产分类:"
              prop="fixedAssetClassificationCodeId"
              :maxLength="50"
            >
              <a-tree-select
                v-model:value="selectFormInfo.fixedAssetClassificationCodeId"
                style="width: 100%"
                :tree-data="fixedAssetClassificationCodeTree"
                tree-checkable
                allow-clear
                :treeCheckStrictly="true"
                placeholder="请选择高等学校固定资产分类"
              />
            </a-form-model-item>
          </a-col>
        </a-row>

        <div
          style="
            display: flex;
            justify-content: flex-end; /* 将内容推到右侧 */
            align-items: flex-end; /* 将内容推到下方 */
            height: 100vh; /* 容器高度设为视口高度，确保它在屏幕底部 */
          "
        >
          <a-button @click="handleCancel" style="margin-right: 0.8rem"
            >取消</a-button
          >
          <a-button
            style="margin-right: 0.8rem"
            @click="handleSubmit"
            type="primary"
            :loading="confirmLoading"
            >保存</a-button
          >
        </div>
        <div style="height: 50px"></div>
      </a-form-model>
    </a-spin>
  </a-drawer>
</template>

<script>
import { getAction, postAction } from '@/api/manage'
import { getDepartTree } from '@/api/api'
import { getCompanyList } from '@/api/api'
export default {
  name: 'DevArchiveFilterGroupEdit',
  components: {},
  data() {
    return {
      deviceTypeTree: [],
      professionalClassificationIdTree: [],
      deviceClassificationTree: [],
      mandatoryInspectionCatalogTree: [],
      politicalProcurementCatalogueTree: [],
      commonMilitaryNameTree: [],
      fixedClassificationTree: [],
      fixedAssetClassificationCodeTree: [],
      campusBuildingFloorRoomTree: [],
      departmentTree: [],
      commonNameList: [],
      visible: false,
      confirmLoading: false,
      selectFormInfo: {
        commonName: undefined,
        cfda: undefined,
        activeState: undefined,
        assetStatus: undefined,
        repairState: undefined,
        assetCode: undefined,
        fixedAssets: undefined,
        period: undefined,
        deviceType: undefined,
        assetCode: undefined,
        currentLocation: undefined,
        departmentId: undefined,
        usingDepartmentId: undefined,
        supplierName: undefined,
        importedDomestic: undefined,
        differentCountrie: undefined,
        manufacturerName: undefined,
        assetValueMin: undefined,
        assetValueMax: undefined,
        purchaseDate: undefined,
        expiringDate: undefined,
        acceptanceDate: undefined,
        entryDate: undefined,
        inputMethod: undefined,
        enterSource: undefined,
        administrativeDept: undefined,
        deviceClassificationId: undefined,
        mandatoryInspectionCatalogId: undefined,
        politicalProcurementCatalogueId: undefined,
        commonMilitaryNameId: undefined,
        fixedClassificationId: undefined,
        fixedAssetClassificationCodeId: undefined,
      },
      formInfo: {
        name: undefined,
        condition: undefined,
        status: undefined,
        createTime: undefined,
        sortOrder: undefined,
        wx: '',
      },
      url: {
        saveInfo: '/system/devArchiveFilterGroup/save',
        getInfo: '/system/devArchiveFilterGroup/info',
        getDeviceTypeTree: '/system/ktree/tree',
        getprofessionalClassificationIdTree:
          '/system/devProfessionalClassification/tree',
        getClassificationTree: '/system/devArchiveDeviceClassification/tree',
        getMandatoryInspectionCatalogTree:
          '/system/devArchiveMandatoryInspectionCatalog/tree',
        getPoliticalProcurementCatalogueTree:
          '/system/devArchivePoliticalProcurementCatalogue/tree',
        getCommonMilitaryNameTree: '/system/devArchiveCommonMilitaryName/tree',
        getFixedClassificationTree:
          '/system/devArchiveFixedClassification/tree',
        getFixedAssetClassificationCodeTree:
          '/system/devArchiveFixedAssetClassificationCode/tree',
        getCampusBuildingFloorRoomTree:
          '/system/devCampusBuildingFloorRoom/listTree',
        getDevArchiveCommonNameList: '/system/devArchiveCommonName/getList',
      },
    }
  },
  created() {
    this.getCampusBuildingFloorRoom()
    // 专业分类
    this.getprofessionalClassificationId()
    //使用科室
    this.getDepartment()
    //器械分类
    this.getClassification()
    //强检目录
    this.getMandatoryInspectionCatalog()
    //政采目录
    this.getPoliticalProcurementCatalogue()
    //政府通用名
    this.getCommonMilitaryName()
    //固资分类
    this.getFixedClassification()
    //固定资产分类与代码
    this.getFixedAssetClassificationCode()
    //设备类型
    this.getDeviceType()
    //通用名
    this.getCommonNameList()
  },
  methods: {
    //通用名
    getCommonNameList() {
      getAction(this.url.getDevArchiveCommonNameList).then((res) => {
        this.commonNameList = res.result.data
      })
    },
    //位置
    getCampusBuildingFloorRoom() {
      getAction(this.url.getCampusBuildingFloorRoomTree).then((res) => {
        this.campusBuildingFloorRoomTree = res.result.data
      })
    },
    //固定资产分类与代码
    getFixedAssetClassificationCode() {
      getAction(this.url.getFixedAssetClassificationCodeTree).then((res) => {
        this.fixedAssetClassificationCodeTree = res.result.data
      })
    },
    //固资分类
    getFixedClassification() {
      getAction(this.url.getFixedClassificationTree).then((res) => {
        this.fixedClassificationTree = res.result.data
      })
    },
    //政府通用名
    getCommonMilitaryName() {
      getAction(this.url.getCommonMilitaryNameTree).then((res) => {
        this.commonMilitaryNameTree = res.result.data
      })
    },
    //政采目录
    getPoliticalProcurementCatalogue() {
      getAction(this.url.getPoliticalProcurementCatalogueTree).then((res) => {
        this.politicalProcurementCatalogueTree = res.result.data
      })
    },
    //强检目录
    getMandatoryInspectionCatalog() {
      getAction(this.url.getMandatoryInspectionCatalogTree).then((res) => {
        this.mandatoryInspectionCatalogTree = res.result.data
      })
    },
    //器械分类
    getClassification() {
      getAction(this.url.getClassificationTree).then((res) => {
        this.deviceClassificationTree = res.result.data
      })
    },
    //使用科室
    getDepartment() {
      getDepartTree().then((res) => {
        this.departmentTree = res.result.data
      })
    },
    //设备类型
    getDeviceType() {
      getAction(this.url.getDeviceTypeTree, {}).then((res) => {
        this.deviceTypeTree = res.result.data
      })
    },
    //专业分类
    getprofessionalClassificationId() {
      getAction(this.url.getprofessionalClassificationIdTree, {}).then(
        (res) => {
          this.professionalClassificationIdTree = res.result.data
        }
      )
    },
    add() {
      this.formInfo.status = '1'
      this.selectFormInfo = {}
      this.edit()
    },
    edit(record) {
      this.$objToOverride(this.formInfo, record)
      if (this.formInfo.id) {
        getAction(this.url.getInfo, { id: record.id }).then((res) => {
          this.$nextTick(() => {
            this.formInfo = res.result.data

            this.selectFormInfo = JSON.parse(this.formInfo.condition)
          })
        })
      }
      this.visible = true
    },
    // 确定
    handleSubmit() {
      // 触发表单验证
      this.confirmLoading = true
      this.$refs.ruleForm.validate((valid) => {
        console.log(valid)
        if (valid) {
          this.formInfo.condition = JSON.stringify(this.selectFormInfo)
          if (
            this.formInfo.condition == null ||
            this.formInfo.condition == '{}'
          ) {
            this.$message.error('请填写查询条件')
            this.confirmLoading = false
            return
          }
          postAction(this.url.saveInfo, this.formInfo)
            .then((res) => {
              this.$message.success(res.content)
              this.$emit('ok', this.formInfo)
              this.close()
            })
            .finally(() => {
              this.confirmLoading = false
            })
        } else {
          this.confirmLoading = false
        }
      })
    },
    // 关闭
    handleCancel() {
      this.close()
    },
    close() {
      this.$refs.ruleForm.resetFields()
      this.$objToReset(this.formInfo)
      this.$emit('close')
      this.visible = false
    },
    editorOk(val) {
      this.formInfo.content = val
    },
  },
}
</script>
